<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<!-- 
	Copyright (C) 2007, 2008, 2009, 2010, 2011. PARP Research Group.
	<http://perception.inf.um.es>
	University of Murcia, Spain.

	This file is part of the QVision library.

	QVision is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as
	published by the Free Software Foundation, version 3 of the License.

	QVision is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with QVision. If not, see <http://www.gnu.org/licenses/>.
-->

<html><head><meta http-equiv="content-Type" content="text/html;charset=UTF-8">
<title>QVision: Qt&#39;s Image, Video and Computer Vision Library</title>
<meta name="title" content="QVision" />
<meta name="dc.title" content="QVision" />
<meta name="url" content="http://perception.inf.um.es/QVision" />
<meta name="author" content="PARP Research Group - http://perception.inf.um.es" />
<meta name="revisit-after" content="30 DAYS"/>
<meta name="robots" content="index,follow"/>
<meta name="classification" content="*">
<meta name="rating" content="Safe For Kids">
<meta name="distribution" content="GLOBAL"/>
<meta name="description" content="Qt's Image, Video and Computer Vision Library"/>
<meta name="page-topic" content="Computer Vision research and prototype programming"/>
<meta name="geo.country" content="ES" />

<!--
Keywords:
By license:		open source, gnu, lgpl, gpl, free
By theme:		computer vision, image processing, robotics, programming, source, development
By usage:		library, toolkit, framework, prototype, application
By programming specs:	object oriented, c++, block programming, reusability, gui, graphical, parallel computing, high performance, GPU, prototyping
Interoperability with:	Qt, GSL, GNU Scientific library, OpenCV, CGAL, QWT, CUDA, mplayer, IPP, Intel Image Performance Primitives, blas, lapack
Functionallity:		image features, matrix algebra, projective geometry, mser, function minimization, function optimization, canny operator, harris operator, corner detection, performance evaluation, cpu usage, graphical interface
Main data-types:	matrix, vector, tensor, quaternion, image, polyline
Video sources:		webcam, camera, stream
Devices:		embedded, desktop computer, laptop, mini-laptop
Authors:		PARP research group. University of Murcia, Spain.
-->

<meta name="keywords" content="augmented reality, sfm, structure from motion, open source, gnu, lgpl, gpl, free, computer vision, image processing, robotics, programming, source, development, library, toolkit, framework, prototype, application, object oriented, c++, block programming, reusability, gui, graphical, parallel computing, high performance, GPU, prototyping, Qt, GSL, GNU Scientific library, OpenCV, CGAL, QWT, CUDA, mplayer, IPP, Intel Image Performance Primitives, blas, lapack, image features, matrix algebra, projective geometry, mser, function minimization, function optimization, canny operator, harris operator, corner detection, performance evaluation, cpu usage, graphical interface, matrix, vector, tensor, quaternion, image, polyline, webcam, camera, stream, embedded, desktop computer, laptop, mini-laptop, University of Murcia, Spain, PARP research group, vision por computador"/>
<meta http-equiv="keywords" content="augmented reality, sfm, structure from motion, open source, gnu, lgpl, gpl, free, computer vision, image processing, robotics, programming, source, development, library, toolkit, framework, prototype, application, object oriented, c++, block programming, reusability, gui, graphical, parallel computing, high performance, GPU, prototyping, Qt, GSL, GNU Scientific library, OpenCV, CGAL, QWT, CUDA, mplayer, IPP, Intel Image Performance Primitives, blas, lapack, image features, matrix algebra, projective geometry, mser, function minimization, function optimization, canny operator, harris operator, corner detection, performance evaluation, cpu usage, graphical interface, matrix, vector, tensor, quaternion, image, polyline, webcam, camera, stream, embedded, desktop computer, laptop, mini-laptop, University of Murcia, Spain, PARP research group, vision por computador"/>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="title" content="QVision"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
</head><body>

<table width="100%"><tr>
	<td><a href="http://perception.inf.um.es/"><img src="parp.png" border="0" /> <big>PARP Research Group</big></a></td>
	<td align="right"><a href="http://www.um.es/"><big>Universidad de Murcia</big> <img src="um.png" border="0" /></a></td>
</tr></table>

<hr /><br />

<table width="95%" align="center"><tr><td>

<!-- Generated by Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
          <form id="FSearchBox" action="search.php" method="get">
            <img id="MSearchSelect" src="search/search.png" alt=""/>
            <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" 
                   onfocus="searchBox.OnSearchFieldFocus(true)" 
                   onblur="searchBox.OnSearchFieldFocus(false)"/>
          </form>
        </div>
      </li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="ManualSections.html">The manual</a>
  </div>
</div>
<div class="contents">


<h1><a class="anchor" id="OpenCVInteroperability">Interoperability with OpenCV </a></h1><p>To enable the QVision to interoperate with OpenCV, the following line must be present (and un-commented) at the <em>config.pri</em> file, prior to compilation and installation of the QVision library:</p>
<div class="fragment"><pre class="fragment">CONFIG += qvopencv
</pre></div><p>QVision applications will automatically link to the include and binary files for the OpenCV library.</p>
<h2><a class="anchor" id="ConvertingQVisionObjectsFromAndToOpenCVTypes">
Converting QVision objects from and to OpenCV types</a></h2>
<p>The QVision includes functionality to convert <a class="el" href="classQVMatrix.html">QVMatrix</a> and <a class="el" href="classQVImage.html">QVImage</a> objects from and to <em>CvMat</em> and <em>IplImage</em> types, making straightforward to include OpenCV code in a QVision application. To convert a <a class="el" href="classQVMatrix.html" title="Implementation of numerical matrices.">QVMatrix</a> object from and to an OpenCV's CvMat structure the developer can use the <a class="el" href="classQVMatrix.html" title="Implementation of numerical matrices.">QVMatrix</a> constructor and conversion operator:</p>
<div class="fragment"><pre class="fragment"><span class="comment">// First create an OpenCv double precission matrix </span>
CvMat *cvMat = cvCreateMat(rows, cols, CV_64F);

<span class="comment">// Next, init the contents of the OpenCV matrix.</span>
[...]

<span class="comment">// Converts the OpenCV matrix to a QVision matrix</span>
<a class="code" href="classQVMatrix.html" title="Implementation of numerical matrices.">QVMatrix</a> qvMatrix = cvMat;

<span class="comment">// Do things with the QVision matrix</span>
[...]

<span class="comment">// Converts the QVision matrix to a new OpenCV matrix</span>
CvMat *cvMat2 = qvMatrix;       

<span class="comment">// Do things with the new OpenCV matrix</span>
[...]

<span class="comment">// Delete OpenCV matrices</span>
cvReleaseMat(&amp;cvMat);   
cvReleaseMat(&amp;cvMat2);
</pre></div><dl class="note"><dt><b>Note:</b></dt><dd>By now, only OpenCV matrices of double precision can be converted from and to <a class="el" href="classQVMatrix.html" title="Implementation of numerical matrices.">QVMatrix</a> objects.</dd></dl>
<p>Similarly, the developer can use <a class="el" href="classQVImage.html" title="Image representation class for the QVision.">QVImage</a> constructor and conversion operators to convert from and to the OpenCV image format (IplImage):</p>
<div class="fragment"><pre class="fragment"><span class="comment">// First create an OpenCV image object.</span>
IplImage *iplImage = cvCreateImageHeader(cvSize(cols, rows), IPL_DEPTH_8U, 1);
cvCreateImageData(iplImage);

<span class="comment">// Next, init the contents of the OpenCV image.</span>
[...]

<span class="comment">// Create a new QVImage object from the &#39;iplImage&#39; object.</span>
<span class="comment">// Both image objects, &#39;iplImage&#39; and &#39;qvImage&#39; will contain the same image.</span>
<a class="code" href="classQVImage.html">QVImage&lt;uChar, 1&gt;</a> qvImage = iplImage;

<span class="comment">// Do things with the QVision image</span>
[...]

<span class="comment">// Create a new OpenCV image object, that will contain the same image as the &#39;qvImage&#39; object.</span>
IplImage *iplImageBis = qvImage;

<span class="comment">// Do things with the new OpenCV image</span>
[...]

<span class="comment">// Finally, release the OpenCV images</span>
cvReleaseImage(&amp;iplImage);
cvReleaseImage(&amp;iplImageBis);
</pre></div><h2><a class="anchor" id="OpenCVExampleApplications">
OpenCV example applications</a></h2>
<p>The <em>examples/OpenCV</em> directory includes some QVision application which use OpenCV functionality.</p>
<p>You can find a list in the module <a class="el" href="group__OpenCVExamplePrograms.html">OpenCV interoperability example programs.</a>. </p>
</div>
</td></tr></table>

<br /><hr><br />
<center><a href="http://perception.inf.um.es/QVision">QVision framework</a>.
<a href="http://perception.inf.um.es">PARP research group</a>.
Copyright &copy; 2007, 2008, 2009, 2010, 2011.</center>
<br />
</body>
</html>
